#include "Action.h"

Action::Action()
{
	p_aList = NULL;
	setUpActionTypes();

}

void Action::setUpActionTypes()
{
	infile.open("stats.txt");
	infile >> array_size;

	p_aList = new action_mods [array_size];

	//int i = 0;
	action_mods temp;

	for (int i = 0; !infile.eof(); i++)
	{
		infile >> temp.name;
		infile >> temp.energy_mod;
		infile >> temp.hunger_mod;
		infile >> temp.hygeine_mod;
		infile >> temp.social_mod;
		infile >> temp.time_spent_mod;

		p_aList[i] = temp;
	}

	infile.close();




/******************************SLEEP*********************************
	Sleep.energy_mod = 100;   //we will make the energy stat equal max when you sleep; no multiplication
	Sleep.happiness_mod = 1.4; //multiply this value by the happiness stat then add result to it
	Sleep.hunger_mod = 1.7;    //same as above but with hunger
	Sleep.name = "Sleep";
	Sleep.social_mod = -1.3;   //negative value means it will decrease the stat
/******************************SLEEP*********************************

/******************************SHOP**********************************
	Shop.energy_mod = -1.3; 
	Shop.happiness_mod = 1.5;
	Shop.hunger_mod = 1.3;
	Shop.name = "Shop";
	Shop.social_mod = 1.3;
/******************************SHOP***********************************/
}

//Takes an action name and sends back the info for that action
action_mods Action::getAction(string n)
{
	action_mods temp;

	temp.name = "None";

	for (int i = 0; i < array_size; i++)
	{
		if (p_aList[i].name == n)
		{
			temp = p_aList[i];
		}
	}

	return temp;

}

action_mods Action::getAct(int i)
{
	action_mods temp;

	temp = p_aList[i];

	return temp;
}

void Action::Release()
{
	/*for (int i = 0; i < array_size; i++)
	{
		delete p_aList[i];
	}*/

	delete [] p_aList;
	p_aList = NULL;
		
	
}

const void Action::Print(int i)
{
	printf("%-9s:%5d   %5d   %5d   %5d   %5d\n", p_aList[i].name.c_str(), p_aList[i].energy_mod, p_aList[i].hunger_mod, p_aList[i].hygeine_mod,
		p_aList[i].social_mod, p_aList[i].time_spent_mod);
}

int Action::getArraySize()
{
	return array_size;
}